﻿using System;
using MugenInjection.Delegates;
using MugenInjection.Interface;

namespace MugenInjection.Syntax.Constant
{
    /// <summary>
    ///     Specific fluent syntax for constant binding.
    /// </summary>
    public interface IConstantCallbackSyntax : IBindingBuilder
    {
        /// <summary>
        ///     Executes callback method before binding activated.
        /// </summary>
        /// <param name="onActivating">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        IConstantCallbackObjectSyntax OnActivating(Action<IBindingContext> onActivating);

        /// <summary>
        ///     Executes callback method after binding activated.
        /// </summary>
        /// <param name="onActivated">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        IConstantCallbackObjectSyntax OnActivated(Action<object> onActivated);

        /// <summary>
        ///     Executes the callback that should be called before instances are released.
        /// </summary>
        /// <param name="onReleaseObject">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        IConstantCallbackObjectSyntax OnReleaseObject(Action<object, bool> onReleaseObject);

        /// <summary>
        ///     Executes callback method after binding disposed.
        /// </summary>
        /// <param name="onDisposed">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        IConstantCallbackObjectSyntax OnDisposed(Action<IBinding> onDisposed);
    }

    /// <summary>
    ///     Specific fluent syntax for constant binding.
    /// </summary>
    public interface IConstantCallbackSyntax<T> : IBindingBuilder
    {
        /// <summary>
        ///     Executes callback method before binding activated.
        /// </summary>
        /// <param name="onActivating">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        IConstantCallbackObjectSyntax<T> OnActivating(Action<IBindingContext> onActivating);

        /// <summary>
        ///     Executes callback method after binding activated.
        /// </summary>
        /// <param name="onActivated">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        IConstantCallbackObjectSyntax<T> OnActivated(Action<T> onActivated);

        /// <summary>
        ///     Executes the callback that should be called before instances are released.
        /// </summary>
        /// <param name="onReleaseObject">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        IConstantCallbackObjectSyntax<T> OnReleaseObject(Action<T, bool> onReleaseObject);

        /// <summary>
        ///     Executes callback method after binding disposed.
        /// </summary>
        /// <param name="onDisposed">The specified callback method.</param>
        /// <returns>The fluent syntax.</returns>
        IConstantCallbackObjectSyntax<T> OnDisposed(Action<IBinding> onDisposed);
    }
}